<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title> <link rel="stylesheet" href="../css/paging.css">
    <script src="../js/paging.js"></script>
</head>
<style>
    table, tr, td, thead {
        border: 1px solid black;
        border-collapse: collapse;
    }

    table td, td a {
        padding: 5px;
        text-decoration: none;
    }

</style>
<body>
<script>
    $(function () {
        getPageData();
    });

    function getPageData() {
        let json = {page: $("#page").val(), pageSize: $("#pageSize").val()};
        let data = myAjax("cookStyleGet", json, "get");
        let html = ' <table>\n' +
            '        <thead style="text-align: center">\n' +
            '        <td style="width: 5%;text-align: center">选中<input type="checkbox" id="allcheck" onclick="checkorcheck()"></td>\n' +
            '        <td style="width: 5%">名称</td>\n' +
            '        <td style="width: 60%">描述</td>\n' +
            '        <td style="width: 10%">操作</td>\n' +
            '        </thead>';
        for (let i = 0; i < data.length; i++) {
            html += '<tr onclick="checktrue()">\n' +
                '            <td style="text-align: center"><input type="checkbox" name="news-checkbox"><input type="hidden" value="' + data[i].id + '"></td>\n' +
                '            <td>' + data[i].name + '</td>\n' +
                '            <td>' + data[i].content + '</td>\n' +
                '            <td style="text-align: center">' +
                '               <a href="javascript:cookStyleUpdate(' + data[i].id + ',' + "'" + 'cookStyleUpdate' + "'" + ')">编辑</a>' +
                '               <a href="javascript:deleteData(' + data[i].id + ',' + "'" + 'cookStyleUpdate' + "'" + ')">删除</a>' +
                '            </td>\n' +
                '        </tr>';
        }
        html += '</table>';
        $("#newsTable").html(html);
    }
    function cookStyleUpdate(id) {
        sessionStorage.setItem("cookStyleUpdateId", id);
        $('#content').load('CookStyleUpdate.html');

    }
</script>
<div id="newsTable">
</div>
</body>
</html>